#define _CRT_SECURE_NO_WARNINGS
#include<stdlib.h>
int cmp(void* e1, void* e2)
{

    return *(int*)e1 - *(int*)e2;

}
int singleNumber1(int* nums, int numsSize)
{
    qsort(nums, numsSize, sizeof(nums[0]), cmp);
    int i = 0;
    if (numsSize == 1)
    {
        return nums[0];
    }
    for (i = 0; i < numsSize - 1; i += 3)
    {
        if (nums[i] != nums[i + 1])
        {
            return nums[i];
        }
    }
    return nums[i];
}
int singleNumber(int* nums, int numsSize)
{
    int result = 0;
    for (int i = 0; i < 32; i++)
    {
        unsigned int count = 0;
        for (int j = 0; j < numsSize; j++)
        {
            count += (nums[j] >> i) & 1;
        }
        result += (count % 3) << i;
    }
    return result;
}
